package pers.qianyu.module.core.comm;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * 通用分页查询对象
 *
 * @author mizzle rain
 * @date 2020-10-12 9:23
 */
public class PageQuery implements Serializable {
    private static final long serialVersionUID = -5391507624525453574L;
    /**
     * 页码
     */
    @NotNull(message = "页码不能为空！")
    @Min(value = 1, message = "页号必须为正数")
    private Integer page = 1;
    /**
     * 页面大小
     */
    @NotNull(message = "每页条数不能为空！")
    @Max(value = 100, message = "每页条数不能超过100条")
    private Integer limit = 20;

    public PageQuery() {
    }

    public PageQuery(@NotNull(message = "页码不能为空！") @Min(value = 1, message = "页号必须为正数") Integer page, @NotNull(message = "每页条数不能为空！") @Max(value = 100, message = "每页条数不能超过100条") Integer limit) {
        this.page = page;
        this.limit = limit;
    }

    public Integer getPage() {
        return page;
    }

    public void setPage(Integer page) {
        this.page = page;
    }

    public Integer getLimit() {
        return limit;
    }

    public void setLimit(Integer limit) {
        this.limit = limit;
    }
}
